package com.atguigu.gmall.all.controller;

import com.atguigu.gmall.common.result.Result;
import com.atguigu.gmall.order.client.OrderFeignClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;

/**
 * 支付相关
 *
 */
@Controller
public class PaymentController {

    @Autowired
    private OrderFeignClient orderFeignClient;

    //去支付页面显示支付信息
    @GetMapping("/pay.html")
    public String pay(Long orderId, Model model){
        //显示信息 查询订单表
        Result result = orderFeignClient.getOrderInfo(orderId);
        model.addAttribute("orderInfo",result.getData());
        return "payment/pay";
    }
    //转成商户成功页面
    //  http://payment.gmall.com/pay/success.html
    @GetMapping("/pay/success.html")
    public String success(){
        return "payment/success";
    }
}
